package com.jarvan.fluwx_example;

import com.sensorsdata.analytics.android.sdk.SAConfigOptions;
import com.sensorsdata.analytics.android.sdk.SensorsAnalyticsAutoTrackEventType;
import com.sensorsdata.analytics.android.sdk.SensorsDataAPI;

import io.flutter.app.FlutterApplication;

public class App extends FlutterApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        initSensorsDataAPI();
    }

    /**
     * 初始化 Sensors Analytics SDK
     */
    private void initSensorsDataAPI() {
        final String SA_SERVER_URL = "https://kylin.huanjutang.com/sa?project=production";
        // 初始化配置
        SAConfigOptions saConfigOptions = new SAConfigOptions(SA_SERVER_URL);
        // 开启全埋点
        saConfigOptions.setAutoTrackEventType(SensorsAnalyticsAutoTrackEventType.APP_CLICK |
        SensorsAnalyticsAutoTrackEventType.APP_START |
        SensorsAnalyticsAutoTrackEventType.APP_END |
        SensorsAnalyticsAutoTrackEventType.APP_VIEW_SCREEN)
        // 开启 log
        .enableLog(true);
        /**
         *
         * 其他配置
         */
        // 需要在主线程初始化神策 SDK
        SensorsDataAPI.startWithConfigOptions(this,saConfigOptions);
    }
}